package com.fd.service;

import com.fd.bean.Demo;
import com.fd.mapper.DemoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class DemoService {
    @Autowired
    private DemoMapper demoMapper;

    public List<Demo> likeName(String name) {
        return demoMapper.likeName(name);
    }

    @Transactional//添加了事务，在方法上面是给当前方法添加，在类中是给类中所有方法添加
    public void save(Demo demo) {
        demoMapper.save(demo);
    }
}